<script type="text/javascript">
	$(document).ready(function(){
		$(".module-product").hide(); // Ẩn toàn bộ nội dung của tab
		$(".module-product:first").show(); // Mặc định sẽ hiển thị tab1
		
		$(".module-title li a").click(function(){ //Khai báo sự kiện khi click vào một tab nào đó
			var activeTab = '#'+$(this).attr("href"); 
			$(".module-title li").removeClass("active"); 
			$(this).parent().addClass("active"); 
			$(".module-product").hide(); 
			$(activeTab).fadeIn(); 
            return false;
		});
	});
</script>

<!-- box san pham 3 hang-->
    <div class="cbox clearfix">
    
        <div class="cbox_header clearfix">
            <span class="cbox_title block left">
                <?php if(!empty($product)){echo $product->title;}?>
            </span>
            <span class="cbox_bg_midd block left"></span>                
        </div>
        
        <div class="cbox_content clearfix detail_product">
        <!------------------------------------------------------------
            NOI DUNG CHI TIET
        -------------------------------------------------------------->
        <div class="title_product clearfix">
            <div class="intro_pro left">
                <?php if(!empty($product)){echo '<img src="'.$product->img.'"/>';}?>
                <h1><?php if(!empty($product)){echo $product->title;}?></h1>
                <span class="cse left block">
                Chia sẻ
                </span>
                <!--************************* share*************************************-->                                
                        <div id="groupsocial">
                            <ul>
                                <li class="lisharebutton" >
                                <a class="sharebutton" id="facebook" title="facebook" onclick="functionshare('facebook')"></a>
                                </li>
                                <li class="lisharebutton" >
                                <a class="sharebutton" id="twitter" title="twitter" onclick="functionshare('twitter')"></a>
                                </li>
                                <li class="lisharebutton" >
                                <a class="sharebutton" id="googleshare" title="googleshare" onclick="functionshare('googleshare')"></a>
                                </li>
                                <li class="lisharebutton" >
                                <a class="sharebutton" id="printf" title="printf" onclick="javascript:window.print()"></a>
                                </li>
                            </ul>
                        </div>
                        
                        <div id="fb-root"></div>
                        <script>
                            (function(d, s, id) {
                                var js, fjs = d.getElementsByTagName(s)[0];
                                if (d.getElementById(id)) return;
                                js = d.createElement(s); js.id = id;
                                js.src = "//connect.facebook.net/<?php if($rear == '_en')echo 'en_US'; else echo 'vi_VN'; ?>/all.js#xfbml=1";
                                fjs.parentNode.insertBefore(js, fjs);
                            }(document, 'script', 'facebook-jssdk'));
                        </script>
                        <div class="fb-like" data-href="<?php echo base_url().$this->uri->uri_string().'.html';?>" data-send="true" data-width="450" data-show-faces="true">
                        </div>
                        <!--*****************share*****************************************-->
            </div> 
            <div class="intro_pro2 right clearfix">
                <table>
                    <tr><th colspan="2">THÔNG TIN SẢN PHẨM</th></tr>
                    <tr>
                        <td>Giá</td>
                        <td><?php if(!empty($product)){echo VndDot($product->price);}?> (vnđ)</td>
                    </tr>
                    <tr>
                        <td>Trạng thái</td>
                        <td>Còn hàng</td>
                    </tr>
                    <tr>
                        <td>Mã sản phẩm</td>
                        <td><?php if(!empty($product)){echo $product->code;}?></td>
                    </tr>
                    <tr>
                        <td>Thời gian bảo hành</td>
                        <td><?php if(!empty($product)){echo $product->tgbaohanh;}?></td>
                    </tr>
                    <tr>
                        <td>Hãng sản xuất</td>
                        <td>
                        <?php 
                        if(!empty($product)){
                            
                            $hsx= $this->common_model->getone('product_manufacturer',array('publish'=>1,'id'=>$product->factory));
                            if(!empty($hsx)){
                                echo $hsx->title;
                            }
                            }
                        
                        ?></td>
                    </tr>
                </table>
                <div class="box_intro_pro right">
                    <form method="POST" action="<?php echo base_url().'cart/add/'.$product->id;?>">
                        Số lượng: <input name="qty" value="1" size="4" type="text"/>                    
                        <input type="submit" value="Đặt mua"/>
                    </form>
                </div>
                <div class="box_intro_pro2 right">
                    <img src="<?php echo base_url();?>skin/default/images/baokim.jpg" />
                </div>
                <div class="box_intro_pro2 right">
                    <img src="<?php echo base_url();?>skin/default/images/nganluong.jpg" />
                </div>
                
            </div>
            
          
     </div>	   
    <div class="main-product clearfix">
    	<ul class="title-inner clearfix module-title">
    		<li class="active" >
    			<a title="" href="tab1">Miêu tả</a>
    		</li>
    		<li>
    			<a title="" href="tab2">Thông số kỹ thuật</a>
    		</li>
    		<li>
    			<a title="" href="tab3">Bảo hành</a>
    		</li>
    	</ul>
        <!-- noi dung tab san pham-->
        <div class="clearfix tabcontent">
        	<div id="tab1" class="module-product">
        		<?php if(!empty($product)){echo $product->description;}?>
        		
        	</div>
        	<!-- end noi dung tab san pham-->
             <!-- noi dung tab san pham-->
        	<div id="tab2" class="module-product">
        			<?php if(!empty($product)){echo $product->fulltext;}?>
        		
        	</div>
        	<!-- end noi dung tab san pham-->
             <!-- noi dung tab san pham-->
        	<div id="tab3" class="module-product">
        		<?php if(!empty($product)){echo $product->baohanh;}?>
        	
        	</div>
        	<!-- end noi dung tab san pham-->
         </div>
</div>
                    
        
        <!------------------------------------------------------------
            NOI DUNG CHI TIET
        -------------------------------------------------------------->
        </div>   
                         
</div><!--end box san pham 3 hang-->           
           
<script>
$(document).ready(function(){
	var url = window.location.href;
	var title = $('title').text();
	title = escape(title);
	var likeface = '<iframe src="//www.facebook.com/plugins/like.php?href='+url+'&amp;send=false&amp;layout=button_count&amp;width=80&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px;" allowTransparency="true"></iframe>';
	$('#likeface').html(likeface);
	$("li.lisharebutton").each(function() {
		$(this).css("opacity", "0.9");
	});
	$("li.lisharebutton").hover(function() {
		$(this)
			.stop().fadeTo(500, 1)
			.siblings().stop().fadeTo(500, 0.2);
	}, function() { // Mouse out
		$(this)
			.stop().fadeTo(500, 0.9)
			.siblings().stop().fadeTo(500, 0.9);
	});
});

function functionshare(id){
	var url = window.location.href;
	var title = $('title').text();
	title = escape(title);
    switch(id){
    	case 'facebook':
            var facebookurl = 'http://www.facebook.com/sharer/sharer.php?u='+url;
            window.open(facebookurl,'','width=600,height=350,toolbar=no,scrollbars=no,left=200,screenX=200,screenY=200,top=200');
            break;
    	case 'twitter':
            var twitterurl = 'http://twitter.com/intent/tweet?source=webclient&text='+url;
            window.open(twitterurl,'','width=600,height=350,toolbar=no,scrollbars=no,top=200,left=200');
            break;
        case 'googleshare':
            var googleshareurl = 'https://plus.google.com/share?url='+url;
            window.open(googleshareurl,'','width=600,height=350,toolbar=no,scrollbars=no,top=200,left=200');
            break;
        case 'printf':
            var printfurl = 'javascript:window.print()';
            $('#printf').attr('href',''+printfurl+'');
            break;
        default:
    		break;
	}
}
</script> 
            
